package com.example.pan.http

import com.example.pan.model.Aria2Response
import com.example.pan.model.Aria2TaskInfo
import com.example.pan.model.Aria2Version
import com.example.pan.model.GlobalOption
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.POST

interface ApiService {

    /**
     * 获取已下载完成列表
     */
    @POST("/jsonrpc")
    suspend fun tellStopped(@Body body: RequestBody): Aria2Response<List<Aria2TaskInfo>>

    /**
     * 获取正在下载完成列表
     */
    @POST("/jsonrpc")
    suspend fun tellActive(@Body body: RequestBody): Aria2Response<List<Aria2TaskInfo>>

    /**
     * 获取暂停的任务
     */
    @POST("/jsonrpc")
    suspend fun tellWaiting(@Body body: RequestBody): Aria2Response<List<Aria2TaskInfo>>


    /**
     * 添加Url
     */
    @POST("/jsonrpc")
    suspend fun addUri(@Body body: RequestBody): Aria2Response<String>

    /**
     * 获取Aria2Version
     */
    @POST("/jsonrpc")
    suspend fun getVersion(@Body body: RequestBody): Aria2Response<Aria2Version>

    /**
     * 获取Aria2配置
     */
    @POST("/jsonrpc")
    suspend fun getGlobalOption(@Body body: RequestBody): Aria2Response<GlobalOption>

    @POST("/jsonrpc")
    suspend fun pause(@Body body: RequestBody): Aria2Response<String>

    @POST("/jsonrpc")
    suspend fun unPause(@Body body: RequestBody): Aria2Response<String>

    @POST("/jsonrpc")
    suspend fun remove(@Body body: RequestBody): Aria2Response<String>

}